import '../../hj_model/video_model.dart';

///推荐界面信息返回
class RecommendListRes {
  List<VideoModel>? vInfo;
  bool? hasNext;
  int? totalPages;
  RecommendListRes({this.vInfo, this.hasNext, this.totalPages});

  static RecommendListRes fromJson(Map<String, dynamic>? map) {
    map ??= {};
    RecommendListRes commentListResBean = RecommendListRes();
    if (map['list'] is List) {
      commentListResBean.vInfo = (map['list'] as List?)?.map((o) => VideoModel.fromJson(o)).toList();
    }else if(map['videos'] is List){
      commentListResBean.vInfo = (map['videos'] as List?)?.map((o) => VideoModel.fromJson(o)).toList();
    } else {
      commentListResBean.vInfo = (map['vInfos'] as List?)?.map((o) => VideoModel.fromJson(o)).toList();
    }
    commentListResBean.totalPages = map['totalPages'];
    commentListResBean.hasNext = map['hasNext'];
    return commentListResBean;
  }
  static RecommendListRes fromListJson(jsonList) {
    jsonList??=[];
    RecommendListRes commentListResBean = RecommendListRes();
    commentListResBean.vInfo = (jsonList as List?)?.map((o) => VideoModel.fromJson(o)).toList();
    commentListResBean.hasNext = true;
    return commentListResBean;
  }

  RecommendListRes.fromVideoSearchJson(Map<String, dynamic> json) {
    vInfo = (json['list'] as List?)?.map((e) => VideoModel.fromJson(e)).toList();
    totalPages = json['total'];
    hasNext = json['hasNext'];
  }

  Map toJson() => {
        "vInfos": vInfo,
        "totalPages": totalPages,
        "hasNext": hasNext,
      };
}
